package com.songlanyun.modules.distributionconfig.controller.admin;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.songlanyun.common.annotation.SysLog;
import com.songlanyun.modules.user.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.songlanyun.modules.distributionconfig.entity.DistributionConfig;
import com.songlanyun.modules.distributionconfig.service.DistributionConfigService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;



/**
 * 平台分销设置，用来总体管控分销的开启与关闭，分销的最高级数，佣金提现的额度
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-12-22 11:43:24
 */
@RestController
@RequestMapping("admin/distributionconfig")
public class DistributionConfigAdminController extends AbstractController {
    @Autowired
    private DistributionConfigService distributionConfigService;



    /**
     * 查看平台分销设置
     */
    @RequestMapping("/info")
    //@RequiresPermissions("distributionconfig:distributionconfig:info")
    public R info(){
		DistributionConfig distributionConfig = distributionConfigService.getConfig();
        return R.ok().put("data", distributionConfig);
    }

    /**
     * 保存平台分销设置
     */
    @SysLog("保存平台分销设置")
    @PostMapping("/set")
    //@RequiresPermissions("distributionconfig:distributionconfig:save")
    public R set(@RequestBody DistributionConfig distributionConfig){
        DistributionConfig obj = distributionConfigService.set(distributionConfig);
        return R.ok().put("data", obj);
    }


}
